home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / sound / sn76477.h < prev    next >
C/C++ Source or Header  |  2000-04-19  |  4KB  |  107 lines

  1. /*****************************************************************************
  2.   SN76477 pins and assigned interface variables/functions
  3.  
  4.                             SN76477_envelope_w()
  5.                            /                    \
  6.                     [ 1] ENV SEL 1            ENV SEL 2 [28]
  7.                     [ 2] GND                  MIXER C [27] \
  8.   SN76477_noise_w() [ 3] NOISE EXT OSC          MIXER A [26]    > SN76477_mixer_w()
  9.           noise_res [ 4] RES NOISE OSC          MIXER B [25] /
  10.          filter_res [ 5] NOISE FILTER RES      O/S RES [24] oneshot_res
  11.          filter_cap [ 6] NOISE FILTER CAP      O/S CAP [23] oneshot_cap
  12.           decay_res [ 7] DECAY RES              VCO SEL [22] SN76477_vco_w()
  13.    attack_decay_cap [ 8] A/D CAP              SLF CAP [21] slf_cap
  14.  SN76477_enable_w() [ 9] ENABLE               SLF RES [20] slf_res
  15.          attack_res [10] ATTACK RES             PITCH [19] pitch_voltage
  16.       amplitude_res [11] AMP                  VCO RES [18] vco_res
  17.        feedback_res [12] FEEDBACK              VCO CAP [17] vco_cap
  18.                     [13] OUTPUT          VCO EXT CONT [16] vco_voltage
  19.                     [14] Vcc              +5V REG OUT [15]
  20.  
  21.     All resistor values in Ohms.
  22.     All capacitor values in Farads.
  23.     Use RES_K, RES_M and CAP_U, CAP_N, CAP_P macros to convert
  24.     magnitudes, eg. 220k = RES_K(220), 47nF = CAP_N(47)
  25.  
  26.  *****************************************************************************/
  27. #ifndef SN76477_SOUND_H
  28. #define SN76477_SOUND_H
  29.  
  30. #define MAX_SN76477 4
  31.  
  32. /* Little helpers for magnitude conversions */
  33. #define RES_K(res) ((double)res*1e3)
  34. #define RES_M(res) ((double)res*1e6)
  35. #define CAP_U(cap) ((double)cap*1e-6)
  36. #define CAP_N(cap) ((double)cap*1e-9)
  37. #define CAP_P(cap) ((double)cap*1e-12)
  38.  
  39. /* The interface structure */
  40. struct SN76477interface {
  41.     int num;
  42.     int mixing_level[MAX_SN76477];
  43.     double noise_res[MAX_SN76477];
  44.     double filter_res[MAX_SN76477];
  45.     double filter_cap[MAX_SN76477];
  46.     double decay_res[MAX_SN76477];
  47.     double attack_decay_cap[MAX_SN76477];
  48.     double attack_res[MAX_SN76477];
  49.     double amplitude_res[MAX_SN76477];
  50.     double feedback_res[MAX_SN76477];
  51.     double vco_voltage[MAX_SN76477];
  52.     double vco_cap[MAX_SN76477];
  53.     double vco_res[MAX_SN76477];
  54.     double pitch_voltage[MAX_SN76477];
  55.     double slf_res[MAX_SN76477];
  56.     double slf_cap[MAX_SN76477];
  57.     double oneshot_cap[MAX_SN76477];
  58.     double oneshot_res[MAX_SN76477];
  59. };
  60.  
  61. /* Noise clock write, useful only if noise_res is zero */
  62. extern void SN76477_noise_clock_w(int chip, int data);
  63.  
  64. /* Enable (one input line: 0 enabled, 1 inhibited) - resets one shot */
  65. extern void SN76477_enable_w(int chip, int data);
  66.  
  67. /* Mixer select (three input lines, data 0 to 7) */
  68. extern void SN76477_mixer_w(int chip, int data);
  69.  
  70. /* Alternatively write the single input lines */
  71. extern void SN76477_mixer_a_w(int chip, int data);
  72. extern void SN76477_mixer_b_w(int chip, int data);
  73. extern void SN76477_mixer_c_w(int chip, int data);
  74.  
  75. /* Select envelope (two input lines, data 0 to 3) */
  76. extern void SN76477_envelope_w(int chip, int data);
  77.  
  78. /* Alternatively use the single input lines */
  79. extern void SN76477_envelope_1_w(int chip, int data);
  80. extern void SN76477_envelope_2_w(int chip, int data);
  81.  
  82. /* VCO select (one input line: 0 external control, 1: SLF control) */
  83. extern void SN76477_vco_w(int chip, int data);
  84.  
  85. void SN76477_set_noise_res(int chip, double res);
  86. void SN76477_set_filter_res(int chip, double res);
  87. void SN76477_set_filter_cap(int chip, double cap);
  88. void SN76477_set_decay_res(int chip, double res);
  89. void SN76477_set_attack_decay_cap(int chip, double cap);
  90. void SN76477_set_attack_res(int chip, double res);
  91. void SN76477_set_amplitude_res(int chip, double res);
  92. void SN76477_set_feedback_res(int chip, double res);
  93. void SN76477_set_slf_res(int chip, double res);
  94. void SN76477_set_slf_cap(int chip, double cap);
  95. void SN76477_set_oneshot_res(int chip, double res);
  96. void SN76477_set_oneshot_cap(int chip, double cap);
  97. void SN76477_set_vco_res(int chip, double res);
  98. void SN76477_set_vco_cap(int chip, double cap);
  99. void SN76477_set_pitch_voltage(int chip, double voltage);
  100. void SN76477_set_vco_voltage(int chip, double voltage);
  101.  
  102. int SN76477_sh_start(const struct MachineSound *msound);
  103. void SN76477_sh_stop(void);
  104. void SN76477_sh_update(void);
  105.  
  106. #endif
  107.